package com.rongj.generation.core.util;

import org.apache.commons.lang.StringUtils;

import java.io.IOException;
import java.util.Properties;

public class Propertys {

    private final static Properties config = new Properties();

    static {
        try {
            config.load(Propertys.class.getResourceAsStream("/application.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String getKey(String key) {
        return config.getProperty(key, "");
    }

    public static String getKey(String key, String defaultValue) {
        String v = config.getProperty(key, defaultValue);
        return StringUtils.isBlank(v) ? defaultValue : v;
    }
}
